package com.example.utils;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;

public class XMLParserUtilsImpl implements com.example.utils.XMLParserUtils {
    @Override
    public void parse(String xml) {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document document = builder.parse(xml);
            System.out.println("XML文件解析成功: " + document.getDocumentElement().getTagName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
